// 查看用户授权
const showAuthSet = function () {
    return new Promise((resolve, reject) => {
        wx.getSetting({
            success: function (res) {
                resolve(res.authSetting);
            },
            fail: function (error) {
                reject(error);
            }
        });
    });
}

// 打开用户授权设置
const openAuthsetting = function () {
    return new Promise((resolve, reject) => {
        wx.openSetting({
            success: function(res) {
                resolve(res.authSetting);
            },
            fail: function (error) {
                reject(error);
            }
        })
    })
}


// 获取用户信息
const getUserProfile = function () {
    return new Promise((resolve, reject) => {
        wx.getUserProfile({
            desc: '用于完善用户资料',
            success: function (res) {
                resolve(res);
            },
            fail: function (error) {
                reject(error);
            }
        });
    })
}


module.exports = {
    showAuthSet,
    getUserProfile,
    openAuthsetting,
}